<template>
  <div>
    <el-dialog v-model="dialogFormVisible" title="用户反馈" width="30%" :before-close="handleClose">
      <el-form ref="condition_params" :model="form" :rules="rules">
<!--        <el-form-item label="问题类型" prop="evaluateType" :label-width="formLabelWidth">-->
<!--          <el-select v-model="form.evaluateType" placeholder="请选择问题类型">-->
<!--            <el-option label="SQL异常" value="SQL异常"></el-option>-->
<!--            <el-option label="回答异常" value="回答异常"></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->
        <el-form-item label="反馈内容" prop="evaluate" :label-width="formLabelWidth">
          <el-input type="textarea" v-model="form.evaluate"></el-input>
        </el-form-item>
<!--        <el-form-item label="评分" :label-width="formLabelWidth">-->
<!--          <el-rate v-model="form.star" show-score text-color="#ff9900" score-template="{value}">-->
<!--          </el-rate>-->
<!--        </el-form-item>-->
      </el-form>
      <template #footer>
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="handleConfirm">确 定</el-button>
      </template>
    </el-dialog>
  </div>
</template>
    
<script>
import { userSuggest,saveEvaluateInfo } from '@/api/chartdb'
import { ElMessage } from 'element-plus'
export default {
  setup() {
    //动态加载css
    let cssPath="";
    let mode=localStorage.getItem("mode")
    if(mode=="dark"){
      cssPath = import("/src/assets/css/dark/index.scss");
    }else if(mode=="light"){
      cssPath = import("/src/assets/css/light/index.scss");
    }
    return {
      cssPath
    };
  },
  props: {
    logSessionId:{
      type: String
    }
  },
  data() {
    return {
      dialogFormVisible: false, // 控制弹窗的显示与隐藏
      form: {
        evaluateStatus:'2',
        evaluateType: '',
        evaluate: '',
      },
      rules: {
        // evaluateType: [{ required: true, message: " ", trigger: "blur" }],
        // evaluate: [{ required: true, message: " ", trigger: "blur" }],
      },
      formLabelWidth: '80px'
    }
  },
  mounted() {
  },
  methods: {
    openDialog() {
      console.log("tttt");
      this.dialogFormVisible = true // 打开弹窗
    },
    handleClose(done) {
      // 在这里可以添加一些关闭弹窗前的逻辑，如果需要的话
      // done(); // 调用 done() 表示关闭弹窗
      this.dialogFormVisible = false // 关闭
    },
    handleConfirm() {
      // 在这里可以添加点击确认按钮后的逻辑
      var par = {
        sessionId:this.logSessionId,
        evaluateStatus: this.form.evaluateStatus,
        evaluateType: this.form.evaluateType,
        evaluate: this.form.evaluate
      }
      this.$refs.condition_params.validate((valid) => {
        if (valid) {
          saveEvaluateInfo(par).then((respos) => {
            ElMessage({
              showClose: true,
              message: '评价成功！',
              type: 'success',
            })
            this.$parent.$parent.$refs.shrikingBox.activeIcon=2
            this.dialogFormVisible = false // 关闭弹窗
          })
        } else {
          this.$message.error('校验不通过，请检查输入项');
        }
      });
    }
  }
}
</script>
    
<style scoped>
/*@import './index.css';*/
.custom-dialog-header {
}
/* 在这里可以添加弹窗样式 */
</style>
    